<!--#include file="../../../core/common/Conn.asp" -->
<!--#include file="../../../core/common/Limit.asp" -->
<!--#include file="../../../core/common/Function.asp" -->
<!--#include file="../../../core/common/UpLoadClass.asp" -->
<%
	dim action
	action = request.QueryString("action")
	if action = "add" then
		call add
	end if
	
	dim TITLE,LINK,IMAGE,SUBJECTID
	
	SUBJECTID = request.QueryString("SUBJECTID")
	
	'新增新闻
	sub add

		'建立上传对象
		set request2 = New UpLoadClass
		
		'设置文件允许的附件类型为gif/jpg/png
		request2.FileType = "gif/jpg/png"
		
		'取无重复的服务器时间字符串作为文件名
		request2.AutoSave = 0
		
		'上传文件的最大字节数
		request2.MaxSize = 0
	
		'设置服务器文件保存路径
		request2.SavePath = "../../resource/upload/"
	
		'设置字符集
		request2.Charset = "UTF-8"
	
		'打开对象
		request2.Open() 

		SUBJECTID = request2.Form("SUBJECTID")
		TITLE = request2.Form("TITLE")
		LINK = request2.Form("LINK")
		IMAGE = request2.Form("IMAGE")
		
		dim rs,sql
		sql = "select * from [LINK] where 1=2"
		set rs = db.query(sql)
		rs.addnew
		rs("TITLE") = TITLE
		rs("LINK") = LINK
		rs("IMAGE") = IMAGE
		rs("SUBJECTID") = SUBJECTID
		rs.update
		rs.close
		set rs = nothing
		
		response.Redirect("index.asp?subjectid=" & SUBJECTID)
	end sub
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CMSLite for ASP</title>
<link href="../../resource/css/reset.css" rel="stylesheet" type="text/css" />
<link href="../../resource/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resource/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../resource/js/common.js"></script>
</head>

<body id="body">
	<div class="title_bar">
	新增 - <%=Get_Subject_Name(SUBJECTID)%>
	</div>
	<form action="?action=add" method="post" enctype="multipart/form-data">
	<p>
		<label>标题</label>
		<input type="text" name="TITLE" id="TITLE" class="textbox" />
	</p>
	<p>
		<label>链接</label>
		<input type="text" name="LINK" id="LINK" class="textbox" />
	</p>
	<p>
		<label>图片</label>
		<input type="file" name="IMAGE" />
	</p>
	<p>
		<input type="submit" class="button_1" value="新增" />
		<input type="button" class="button_1" value="返回" onclick="location.href='index.asp?subjectid=<%=SUBJECTID%>';" />
		<input type="hidden" name="SUBJECTID" value="<%=SUBJECTID%>" />
	</p>
	</form>
</body>
</html>
